home *** CD-ROM | disk | FTP | other *** search
-
- #define _NV3x_
-
- #ifdef _NV3x_
- #define HALF half
- #define HALF2 half2
- #define HALF4 half4
- #define HALF3 half3
- #define HALF3x3 half3x3
- #else
- #define HALF float
- #define HALF2 float2
- #define HALF4 float4
- #define HALF3 float3
- #define HALF3x3 float3x3
- #endif
-
- HALF fresnel( HALF3 normal, float3 E, HALF powscale ) {
- return pow(1 - pow(dot(normal, E), 2), powscale); // fresnel = 1 - (N dot E)^2
- }
-
- HALF diffuse( HALF3 normal, float3 L) {
- HALF result = saturate(dot( normal, L));
- result *= saturate( L.z*8 ); //self shadowing
- return result;
- }
-
- HALF phong( float3 R, float3 L, HALF power) {
- return pow(saturate(dot(R, L)), power);
- }
-
- HALF blinn( float3 H, HALF3 normal, HALF power) {
- return pow(saturate(dot(H, normal)), power);
- // dodac self shadowing
- }
-
- HALF luminance( HALF3 i ) {
- return dot(i, HALF3( 0.13f, 0.23f, 0.33f));
- }
-
-